//两数之和
let nums=[2,7,11,15],target=9
function objs(nums:number[],target:number){
   for (let i = 0; i < nums.length; i++) {
      for (let j = 1; j < nums.length; j++) {
          if(nums[i]+nums[j]==target){
               return [i,j]
          }
      }
   }
}
console.log(objs(nums,target));

//回文数
function Hw(str:number){
    let str1=str.toString().split("")    //转换成字符串
    if(str1[0]==str1[str1.length-1]){    //判断下标是赋相等
        return true
    }else{
        return false
    }
}
console.log(Hw(121));

//删除有序数组中的重复项
function Cf(nums:number[]){
  for (let i = 0; i < nums.length; i++) {
       if(nums[i]==nums[i+1]){
           nums.splice(nums[i],nums[i+1])
       }
  }
  return nums
}

console.log(Cf([1,1,2,2,3,3,4,4]));   //1,2,3,4


export {};